/*
 * Copyright (c) 2018. czmc All Rights Reserved.
 * Author: czmc
 * Email: zxc6355533@163.com
 * Encoding: UTF-8
 */

package top.stime21.myneighbours.api

import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
import top.stime21.myneighbours.data.dto.*

/**
 * Created by MZone on 2/6/2017.
 * RSA加密的接口
 */

interface DataApi {
    /*七牛token信息**/
    @GET("api1/user/getqntoken")
    fun getTokenQiniu(): Observable<StringResult>

    /*测试**/
    @GET("api1/user/test")
    fun test(@Query("param1") param1: String): Observable<String>

    @GET("api1/feedback")
    fun feedback(@Query("email") phone: String, @Query("content") content: String): Observable<BaseResult>

    @GET("api1/user/sendsms")
    fun sendsms(@Query("phone") phone: String): Observable<BaseResult>

    @GET("api1/user/phonelogin")
    fun phonelogin(@Query("phone") phone: String, @Query("code") code: String): Observable<UserResult>

    @GET("api1/need/publish")
    fun publish(@Query("type") type: Int, @Query("uid") uid: Long, @Query("address") address: String, @Query("lat") lat: Double, @Query("lon") lon: Double, @Query("content") content: String, @Query("title") title: String): Observable<BaseResult>

    @GET("api1/need/accept")
    fun accept(@Query("id") id: Long, @Query("uid") uid: Long): Observable<BaseResult>

    @GET("api1/need/cancle")
    fun cancle(@Query("id") id: Long, @Query("uid") uid: Long, @Query("type") type: Int): Observable<BaseResult>

    @GET("api1/need/finish")
    fun finish(@Query("id") id: Long, @Query("uid") uid: Long): Observable<BaseResult>

    @GET("api1/need/nearby")
    fun nearby(@Query("lat") lat: Double, @Query("lon") uid: Double, @Query("limit") limit: Int): Observable<NeedResult>

    @GET("api1/need/search")
    fun search(@Query("key") key: String): Observable<NeedResult>

    /*更改信息**/
    @GET("api1/user/{field}/update")
    fun updateInfo(@Path("field") field: String, @Query("value") value: String, @Query("uid") uid: Long): Observable<UserResult>

    @GET("api1/need/myneeds")
    fun myneeds(@Query("uid")uid:Long, @Query("type") type: Int,@Query("page") page: Int,@Query("limit") limit: Int): Observable<NeedResult>

    @GET("api1/need/details")
    fun details(@Query("id") id: Long): Observable<NeedDetailsResult>

    @GET("api1/need/userskills")
    fun userskills(@Query("uid") uid: Long): Observable<UserSkillResult>

    @GET("api1/need/skills")
    fun skills(): Observable<SkillResult>

    @GET("api1/checkupdate")
    fun checkupdate(): Observable<AppInfoResult>
}
